<template>
	<view>
		<view class="agent-box">
			<image src="../../static/demo.jpg" mode="aspectFill"></image>
			<view>
				<view><text>{{agent.user_name}}</text>{{agent.phone}}</view>
				<view>
					<view>经纪公司：{{agent.company}}</view>
					<view>活动区域：{{agent.address}}</view>
					<view>签约时间：2020-12-21</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import store from '@/store/store.vue'
export default {
	onLoad(){
		let _this = this
		let open_id = getApp().globalData.open_id
		uni.request({
			url: store.url + '/user/get_signed_agent?openId=' + open_id,
			method: 'GET',
			header: {				
			},
			success: (res) => {			
				if(res.data.status == 'success'){
					_this.agent = res.data.message 	
				}else{
					uni.showModal({
						title: '提示',
						content: '错误: ' + res.data.message
					});	
				}																      
			},
			fail: (res)=>{
				uni.showModal({
					title: '提示',
					content: '访问服务器失败: ' + res.data.message
				});						
			}
		});		
	},
	data() {
		return {
			agent: {
				'user_name':'',
				'phone':'',
				'compnay':'',
				'address':''
			}
		};
	}
}
</script>

<style lang="scss" scoped>
	.agent-box {
		display: flex;
		padding: 25px;
		box-sizing: border-box;
		background: #FFF;
		
		image {
			margin-right: 20rpx;
			width: 136rpx;
			height: 136rpx;
			border-radius: 50%;
			overflow: hidden;
		}
		
		>view {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			flex: 1;
			overflow: hidden;
			
			> view {
				overflow: hidden;
				text-overflow:ellipsis;
				white-space: nowrap;
				line-height: 1.5;
				font-size: 24rpx;
				color: #bdbdbd;
				
				view {
					font-size: 24rpx;
				}
				
				text {
					margin-right: 20rpx;
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
					font-size: 34rpx;
					font-weight: bold;
					color: #000;
				}
			}
		}
	}
</style>
